Two methods for the preparation of semiconductor doped sol-gel films, for applications in nonlinear optics, have been studied and compared. In the first, porous films are spun from sols containing the cation precursor, and then reacted with H2S gas, and in the second, the cation is adsorbed onto the pore surfaces of passive films from aqueous solution before the gas reaction. Extensive results for CdS doping are given, and preliminary results are reported for other semiconductor species. It is shown that a sputtered silica layer can seal the structure to allow further heat treatment without loss of dopant. The effects of heat treatment of doped films are described, and the limitation of crystallite growth by pore size is shown.